Skip to content

fix(zebra-print): differentiate timeout from success on network send#47

Merged
u8array merged 2 commits into
mainfrom
fix/zebra-network-print-status
May 10, 2026
Merged

fix(zebra-print): differentiate timeout from success on network send#47
u8array merged 2 commits into
mainfrom
fix/zebra-network-print-status

Conversation

@u8array
Copy link
Copy Markdown
Owner

@u8array u8array commented May 10, 2026

No description provided.

Previously sendViaNetwork swallowed every non-refused exception and
returned void, so the dialog always painted a green 'ZPL sent
successfully' for both real prints AND wrong-IP timeouts — a false
positive that hid failed sends.

Replace the void / throw mix with a NetworkPrintResult discriminated
union (responded | no_response | refused). Raw-socket printers normally
never reply with HTTP, so 'no_response' is the typical success path —
but the same exception is raised when the host is unreachable, and the
browser cannot tell those apart. The dialog now reports 'Sent. Verify
on the printer.' for that case instead of an unverified green-success.

Adds the sentNoResponse locale key across all 32 languages.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the network printing logic to handle raw-socket printers more accurately by introducing a NetworkPrintResult type and updating the UI with a new 'sentNoResponse' status. Review feedback suggests validating HTTP status codes in the responded case to avoid false positives and correcting a script inconsistency in the Serbian translation.

Comment thread src/components/Output/PrintToZebraDialog.tsx
Comment thread src/locales/sr.ts Outdated
Reviewer-spotted (gemini-code-assist on PR #47):
- A print server / proxy that responds with 4xx or 5xx was previously
  shown as green-success because the dialog flagged any `responded`
  result as success. Gate the success path on 2xx; non-2xx surfaces
  errorGeneric.
- The sentNoResponse translation in sr.ts was emitted in Cyrillic, but
  the rest of the zebraPrint block in that file is Latin script. Switch
  to Latin for in-block consistency.
@u8array u8array merged commit be67e8a into main May 10, 2026
2 checks passed
@u8array u8array deleted the fix/zebra-network-print-status branch May 10, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant